package com.homwork;

public class ThreadOneTest {
    public void main(String[] args) {
        ThreadOne to = new ThreadOne();
        to.start();
        // ThreadTwo  tw = new ThreadTwo();
        //Thread thread = new Thread(tw);
        //thread.start();
        for (int i = 1; i <= 100; i++) {
            System.out.println(Thread.currentThread().getName() + i + "打印数字：---------");
        }
    }


     class ThreadOne extends Thread {
        @Override
        public void run() {
            for (int i = 1; i <= 100; i++) {
                this.setName("第一种线程方法");
                System.out.println(this.getName() + "打印当前数字：" + i + "======");
            }
        }
    }
}


/*lass ThreadTwo implements Runnable {
    @Override
    public void run() {
        for (int i = 1; i <= 100; i++) {
            System.out.println(Thread.currentThread().getName() + "打印当前数字：" + i + "~~~~~~~");
        }
    }
}*/